const waitTime = (time: number = 100) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(true);
    }, time);
  });
};

const getSort = (params: any, sort: any) => {
  if (JSON.stringify(sort) !== '{}') {
    for (const x in sort) {
      if (sort[x] === 'ascend') {
        sort[x] = 'desc';
      } else {
        sort[x] = 'asc';
      }
    }
    params.sort = sort;
  }
  return params;
};

const setLsetData = (res: API.ResponseData) => {
  if (res.status === 20000) {
    return { success: true, data: res.data.list, total: res.data.total };
  }
  return {};
};
export { waitTime, getSort, setLsetData };
